home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 536 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.3 KB  |  51 lines

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: David Byrden <100101.2547@compuserve.com>
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Calling X(int) from X()'s init list
  5. Date: 25 Feb 1996 16:44:44 GMT
  6. Organization: self-employed
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <4gognf$et@news.bridge.net>
  9. References: <4gnush$phg@news.kth.se>
  10. NNTP-Posting-Host: taumet.eng.sun.com
  11. Mime-Version: 1.0
  12. Content-Type: text/plain; charset=us-ascii
  13. Content-Transfer-Encoding: 7bit
  14. X-Nntp-Posting-Host: ppp-mia2-77.bridge.net
  15. X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
  16. Content-Length: 275
  17. Originator: clamage@taumet
  18.  
  19.  
  20.  
  21.  
  22. <<<<<<<
  23.  
  24. Why is it not allowed to delegate the initialisation to another
  25. constructor
  26.  
  27. class X
  28. {
  29. public:
  30.     X (int i) : i_(i) {}
  31.  
  32.     X () : X(34) {}             // Not allowed
  33. >>>>>>>>>
  34.  
  35.  
  36.      Why not use      X (int i = 34 ) : i_(i) {}
  37.  
  38.  
  39.                       David
  40.  
  41. [ I think he was concerned with the more general case of a complicated
  42.   initialization (not assignment) that must be repeated for each
  43.   constructor. -sdc, moderator
  44. ]
  45. [ To submit articles: Try just posting with your newsreader.
  46.               If that fails, use mailto:std-c++@ncar.ucar.edu
  47.   FAQ:    http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  48.   Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  49.   Comments? mailto:std-c++-request@ncar.ucar.edu
  50. ]
  51.